package com.example.demo.service;

import javax.annotation.Resource;

import com.example.demo.event.DemoTestEvent;

import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

import lombok.extern.slf4j.Slf4j;

@Service
@Slf4j
public class DemoServiceImpl implements DemoService{

  @Resource
  private ApplicationContext ac;

  @Override
  public String query() {
    String name = Thread.currentThread().getName();
    log.info("demoService query thread name:{}", name);
    ac.publishEvent(new DemoTestEvent(this, "DemoServcie.query"));
    return "query is ok";
  }
    
}